﻿using System;
using System.Collections.Generic;
using Volo.Abp.MultiTenancy;

namespace Xms.Abp.BackgroundJob;

public class BackgroundJobInfo: IMultiTenant
{
    public Guid Id { get; set; }

    public virtual string Name { get; set; }

    public virtual string DisplayName { get; set; }

    public virtual string JobArgs { get; set; }

    public virtual Guid? ScheduleId { get; set; }

    public virtual List<int> RetryIntervals { get; } = new List<int>();

    public virtual short TryCount { get; set; }

    public virtual short? MaxTryCount { get; set; }

    public virtual DateTime CreationTime { get; set; }

    public virtual DateTime NextTryTime { get; set; }

    public virtual DateTime? LastTryTime { get; set; }

    public virtual DateTime? TryTimeoutTime { get; set; }

    public virtual BackgroundJobStatus BackgroundJobStatus { get; set; }

    public virtual string ErrorMessage { get; set; }

    public virtual int? Timeout { get; set; }

    public virtual bool IsAbandoned { get; set; }

    public virtual BackgroundJobPriority Priority { get; set; }

    public List<Guid> ReferenceJobs { get; } = new List<Guid>();

    public Guid? TenantId { get; set; }

    public BackgroundJobInfo()
    {
        Priority = BackgroundJobPriority.Normal;
    }
}
